package com.flynn.rock.system.api;

import com.flynn.rock.system.convert.AbstractMessageConvert;
import com.flynn.rock.system.entity.SysMessageEntity;
import com.flynn.rock.system.model.dto.SaveMessageDto;
import com.flynn.rock.system.repository.SysMessageRepository;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class SysMessageApi implements ISysMessageApi {

    @Resource
    private SysMessageRepository sysMessageRepository;

    @Override
    public void saveMessage(SaveMessageDto dto) {
        SysMessageEntity messageEntity = AbstractMessageConvert.INSTANCE.toMessageEntity(dto);
        sysMessageRepository.save(messageEntity);
    }
}
